<template>
  <a-row type="flex">
    <a-col :flex="toggle ? '260px' : '30px'" style="margin-right: 12px; background-color: #fff" v-if="componentName === 'examineQuery'">
      <depart-tree :departType='2' :rootOpened="true" :multi="false" @ok="getTreeData" @toggleBool="toggleBool" />
      <!-- <groups-tree @tree="getTreeData" @selectedKeys="getSelectedKeys" /> -->
    </a-col>
    <a-col flex="auto" style="width:0;">
      <a-card :bordered="false" style="margin-bottom: 10px">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <a-form-model :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="onQuery">
            <a-row>
              <a-col :span="6">
                <a-form-model-item label="计划名称">
                  <a-input v-model="queryParam.planName" placeholder="请输入" />
                </a-form-model-item>
              </a-col>
              <a-col :span="6">
                <a-form-model-item label="计划编号">
                  <a-input v-model="queryParam.planNo" placeholder="请输入" />
                </a-form-model-item>
              </a-col>
              <a-col :span="6">
                <a-form-model-item label="考核类型">
                  <a-select v-model="queryParam.assessType" placeholder="请选择" style="width:100%;" allowClear>
                    <a-select-option v-for="(item, key) in examinType" :key="key" :value="item.value">{{ item.title }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <!--<a-col :span="6">
                <a-form-model-item label="考核状态">
                  <a-select v-model="queryParam.assessStatus" placeholder="请选择" style="width:100%;" allowClear>
                    <a-select-option v-for="(item, key) in examinStatus" :key="key" :value="item.value">{{ item.title }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>-->
            </a-row>
            <a-row>
              <a-col :span="6" v-if="componentName === 'bgtQuery'">
                <a-form-model-item label="指标名称">
                  <a-input v-model="queryParam.indicatorName" placeholder="请输入" />
                </a-form-model-item>
              </a-col>
              <a-col :span="6">
                <a-form-model-item label="考核时间">
                  <a-range-picker format="YYYY-MM-DD"
                                  valueFormat="YYYY-MM-DD"
                                  v-model="assessTime"
                                  @change="onChangeCheck($event)"
                                  style="width: 100%"/>
                </a-form-model-item>
              </a-col>
              <a-col :span="6">
                <a-form-model-item>
                  <a-button type="primary" @click="onQuery"> 查询 </a-button>
                  <a-button style="margin-left: 10px" @click="onResetForm"> 重置 </a-button>
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-card>
      <a-card>
        <div class="table-page-content">
          <z-table ref="table" rowKey="id" :showAlert="false" :showSelection="true" :loading="loading"
                   :columns="columns" :dataSource="pageData" @selectedRow="onSelectedRow" @change="onTableChange">
            <!--操作-->
            <template slot="action" slot-scope="text,record">
              <a-button type="link" style="padding: 0" @click.stop="onDetail(record)" v-if="componentName !== 'bgtQuery'">生成报告</a-button>
              <a-button type="link" style="padding: 0" @click.stop="onDetail(record)" v-if="componentName === 'bgtQuery'">详情</a-button>
            </template>
          </z-table>
        </div>
      </a-card>
    </a-col>
    <bgt-detail
      ref="bgtDetail"
      v-if="visible"
      :visible.sync="visible"
    />
  </a-row>

</template>

<script>
  import commonJs from '../mixins/common'
  import DepartTree from '@/views/sjsk/modules/departTree'
  import bgtDetail from '../components/bgtDetail'

  export default {
    name: "searchExamine-extendsCom",
    mixins:[commonJs],
    components: {
      DepartTree,
      bgtDetail
    },
    data() {
      return {
        toggle: true,
        visible:false,
      }
    },
    methods: {
      // 选中组织架构树，赋值到人员列表搜索框
      getTreeData(datas, id) {
        console.log(datas, id)
        this.$set(this.pageFilter, 'assessUser', id)
      },
      toggleBool(bool) {
        console.log(bool)
        this.toggle = bool
      }
    }
  }
</script>
<style lang="less" scoped></style>